package com.dong.service.impl;

import com.dong.dao.VideoTypeMapper;
import com.dong.entitys.Video;
import com.dong.entitys.VideoType;
import com.dong.service.VideoService;
import com.dong.service.VideoTypeService;
import com.dong.tools.DBTools;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class VideoTypeServiceImpl implements VideoTypeService {
    @Override
    public VideoType selectById(Integer id) {
        SqlSession session = DBTools.getSession();
        VideoTypeMapper mapper = session.getMapper(VideoTypeMapper.class);
        VideoType videoType = mapper.selectById(id);
        session.commit();
        session.close();
        return videoType;
    }

    @Override
    public List<VideoType> selectAllVideoType() {
        SqlSession session = DBTools.getSession();
        VideoTypeMapper mapper = session.getMapper(VideoTypeMapper.class);
        List<VideoType> videoTypes = mapper.selectAllVideoType();
        session.commit();
        session.close();
        return videoTypes;
    }
}
